
#ifndef __SQUARE_H__
#define __SQUARE_H__

#include <Rectangle.h>

template <typename T> class Square
{
 public:

      Square(T side);
      ~Square();
      T computeArea() const;
      T computePerimeter() const;
      void setSide(const T side);

 private:

      T side_m;
      Rectangle<T> *rectangleP;
 
};

template <typename T> 
Square<T>::Square(T side)
{
      side_m = side;
      rectangleP = new Rectangle<T>(side, side);
}

template <typename T> 
Square<T>::~Square()
{
     if (rectangleP) delete rectangleP;
}

template <typename T> T
Square<T>::computeArea() const
{
     return rectangleP->computeArea();
}


template <typename T> T
Square<T>::computePerimeter() const
{
     return rectangleP->computePerimeter();
}

template <typename T> void 
Square<T>::setSide(const T side) 
{
     side_m = side;
     rectangleP->setLength(side);
     rectangleP->setWidth(side);
}


#endif

